/*
 * =====================================================================================
 *
 *       Filename:  Player.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  10/25/11 11:41:41
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  LittleQ Su (), 98703060@nccu.edu.tw
 *        Company:  National Chengchi University, The Department of Computer Science
 *
 * =====================================================================================
 */
#include "headers.h"

#define HAND_MAX 5

// Implementation of Player

void Player::addCard(Card card) {
    if ( this -> index >= HAND_MAX ) {
        cout << "Full." << endl;
        return;
    }

    this -> cards[this -> index] = *(new Card(card.getSuit(), card.getPoint()));
    this -> index ++ ;
}


Card Player::getCard(int i) {
    if ( i > HAND_MAX ) {
        cout << "out of range" << endl;
    }

    return this -> cards[i-1];
}

void Player::drawHandCards(Dealer::Dealer dealer) {
    for (int i = 0 ; i < HAND_MAX ; i++ ) {
        this -> addCard(dealer.dealCard());
    }
}
